home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / gfx / show / h8ilbm.lha / h8ilbm / src / render.asm < prev    next >
Assembly Source File  |  2000-12-16  |  3KB  |  168 lines

  1. ;*****************************************************************************
  2. ;
  3. ;    h8ilbm - HiQuality-HAM8 IFF-24bit image viewer
  4. ;    Copyright (C) 2000  Michael Henke
  5. ;
  6. ;    This program is free software; you can redistribute it and/or modify
  7. ;    it under the terms of the GNU General Public License as published by
  8. ;    the Free Software Foundation; either version 2 of the License, or
  9. ;    (at your option) any later version.
  10. ;
  11. ;    This program is distributed in the hope that it will be useful,
  12. ;    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;    GNU General Public License for more details.
  15. ;
  16. ;    You should have received a copy of the GNU General Public License
  17. ;    along with this program; if not, write to the Free Software
  18. ;    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19. ;
  20. ;*****************************************************************************
  21.  
  22.  
  23.     XDEF    _render_h8row
  24.  
  25.     section    whatever,code
  26.  
  27.  
  28. ;** render_h8row **
  29. ;
  30. ;parameters:
  31. ; a0 UBYTE *rowbuf,
  32. ; d0 UWORD iw16,
  33. ; a1 struct BitMap *bmap,
  34. ; d1 UWORD row
  35.  
  36.  
  37. RENDER    MACRO
  38.     add.w    d3,d3    ;1
  39.     addx.l    d0,d0
  40.     add.w    d4,d4
  41.     addx.l    d0,d0
  42.     add.w    d5,d5
  43.     addx.l    d0,d0
  44.     add.l    d0,d0
  45.     add.w    d3,d3    ;2
  46.     addx.l    d0,d0
  47.     add.w    d4,d4
  48.     addx.l    d0,d0
  49.     add.w    d5,d5
  50.     addx.l    d0,d0
  51.     add.l    d0,d0
  52.     add.w    d3,d3    ;3
  53.     addx.l    d0,d0
  54.     add.w    d4,d4
  55.     addx.l    d0,d0
  56.     add.w    d5,d5
  57.     addx.l    d0,d0
  58.     add.l    d0,d0
  59.     add.w    d3,d3    ;4
  60.     addx.l    d0,d0
  61.     add.w    d4,d4
  62.     addx.l    d0,d0
  63.     add.w    d5,d5
  64.     addx.l    d0,d0
  65.     add.l    d0,d0
  66.     add.w    d3,d3    ;5
  67.     addx.l    d0,d0
  68.     add.w    d4,d4
  69.     addx.l    d0,d0
  70.     add.w    d5,d5
  71.     addx.l    d0,d0
  72.     add.l    d0,d0
  73.     add.w    d3,d3    ;6
  74.     addx.l    d0,d0
  75.     add.w    d4,d4
  76.     addx.l    d0,d0
  77.     add.w    d5,d5
  78.     addx.l    d0,d0
  79.     add.l    d0,d0
  80.     add.w    d3,d3    ;7
  81.     addx.l    d0,d0
  82.     add.w    d4,d4
  83.     addx.l    d0,d0
  84.     add.w    d5,d5
  85.     addx.l    d0,d0
  86.     add.l    d0,d0
  87.     add.w    d3,d3    ;8
  88.     addx.l    d0,d0
  89.     add.w    d4,d4
  90.     addx.l    d0,d0
  91.     add.w    d5,d5
  92.     addx.l    d0,d0
  93.     move.l    d0,d2    ;correct blue2
  94.     and.l    d1,d2
  95.     add.l    d0,d0
  96.     or.l    d2,d0
  97.     ENDM
  98.  
  99.  
  100. _render_h8row
  101.     movem.l    d0-d7/a0-a6,-(a7)
  102.  
  103.     move.w    (a1),d7            ;bmap.BytesPerRow
  104.     add.w    d7,d7            ;screen: 2 pixels per byte
  105.     cmp.w    d0,d7
  106.     bmi.b    min_bpr
  107.     move.w    d0,d7
  108. min_bpr    lsr.w    #4,d7
  109.     subq.w    #1,d7
  110.     move.w    d7,horiz_counter
  111.  
  112.     lsr.w    #3,d0
  113.     move.w    d0,image_bpr+2
  114.  
  115.     move.w    (a1),d0            ;bmap.BytesPerRow
  116.     mulu    d0,d1
  117.     move.l    d1,bitplane_offset
  118.  
  119.     moveq    #6-1,d6            ;bitplane loop counter
  120.     lea    8(a1),a6        ;&bmap.Planes[0]
  121.     move.l    #$11111111,d1
  122.     move.l    image_bpr(pc),d2
  123.  
  124. bitplane_loop
  125.     move.l    (a6)+,a2        ;bmap.Planes[i]
  126.     add.l    bitplane_offset(pc),a2
  127.     move.l    a0,a3            ;&red[i]
  128.     move.l    d2,d3
  129.     add.l    d2,d2
  130.     add.l    d3,d2
  131.     lea    (a3,d2.l*2),a4        ;&green[i]
  132.     lea    (a4,d2.l*2),a5        ;&blue[i]
  133.  
  134.     move.w    (a3)+,d3
  135.     move.w    (a4)+,d4
  136.     move.w    (a5)+,d5
  137.     RENDER
  138.     move.l    d0,(a2)+
  139.     RENDER
  140.     subq.w    #1,d7
  141.     bmi    horiz_end
  142. horiz_loop
  143.     move.w    (a3)+,d3
  144.     move.w    (a4)+,d4
  145.     move.w    (a5)+,d5
  146.     move.l    d0,(a2)+
  147.     RENDER
  148.     move.l    d0,(a2)+
  149.     RENDER
  150.     dbf    d7,horiz_loop
  151. horiz_end
  152.     move.l    d0,(a2)+
  153.  
  154.     move.w    horiz_counter(pc),d7
  155.     move.l    image_bpr(pc),d2
  156.     add.l    d2,a0
  157.     dbf    d6,bitplane_loop
  158.  
  159.     movem.l    (a7)+,d0-d7/a0-a6
  160.     rts
  161.  
  162.  
  163. horiz_counter    dc.w    0
  164. image_bpr    dc.l    0
  165. bitplane_offset    dc.l    0
  166.     END
  167.  
  168.